package ca.ubc.icapture.genapha.actions;

import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.Action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ca.ubc.icapture.genapha.forms.ResultListForm;
import ca.ubc.icapture.genapha.beans.Tools;


import icapture.SQLMgr;


/**
 * Created by IntelliJ IDEA.
 * User: btripp
 * Date: Sep 13, 2006
 * Time: 9:38:59 AM
 * To change this template use File | Settings | File Templates.
 */
public class ResultListAction extends Action {

   /**
	* Constructor
	*/
	public ResultListAction() {
		super();
	}

    public ActionForward execute(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {

        ActionForward forward = new ActionForward();
        ResultListForm resultListForm = (ResultListForm) form;
        resultListForm.setResultList(SQLMgr.getResults(Tools.getUsername(request)));
        forward = mapping.findForward("success");

        return forward;
	}

}
